package com.slanmao.service.impl;

import com.slanmao.entity.UserInfo;
import com.slanmao.mapper.UserMapper;
import com.slanmao.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <CODE>UserServiceImpl</CODE>
 * 用户信息服务
 * @author fenrir
 * @Date 19-3-7
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;


    @Override
    public int insert(UserInfo userInfo) {
        return userMapper.insert(userInfo);
    }

    @Override
    public List<UserInfo> list(int start,int size) {
        Map<String,Integer> param = new HashMap<>(2);
        param.put("start",start);
        param.put("size",size);
        return userMapper.list(param);
    }

    @Override
    public UserInfo findByOpenId(String openid) {
        return userMapper.findByOpenId(openid);
    }

    @Override
    public int count() {
        return userMapper.count();
    }
}
